/*
 * uart1.h
 *
 *  Created on: 13-11-2012
 *      Author: Skeith
 */

#ifndef UART1_H_
#define UART1_H_

#include "../Startup/general.h"
#include "../Startup/lpc2xxx.h"
#include "../Startup/config.h"
#include "utils.h"
#include "lcd.h"
#include "lcd_hw.h"

#define UART1_PINSEL_MASK (1 << 16 | 1 << 17 | 1 << 18 | 1 << 19)

#define CRYSTAL_FREQUENCY FOSC
#define PLL_FACTOR        PLL_MUL
#define VPBDIV_FACTOR     PBSD

//XModem data
/*#define soh 0x01
#define	eot 0x04
#define ack 0x06
#define	nak 0x15
#define	can 0x18
#define	c 0x43

struct packet
{
	char startOfHeader;
	tU8 packetNum;
	tU8 packetNumCompl;
	char fileData[128];
	tU8 checkSum1;
	tU8 checkSum2;
};

struct packet dataToSend;

tBool useCRC;
tU8 initSign;
tU16 packetNumber;

tU16 crc;
tU8 checksum;
tU32 stopPoint;
tBool eof;*/

void Uart1Init();
void Uart1SendChar(tU8 ch);
void Uart1SendBuffer(tU8* pBuff, tU16 count);
tU8 Uart1GetChar();
void Uart1GetBuffer(tU8* readBuffer, tU16 count);
tBool Uart1ReadCheck();
void Uart1SetPinsel(void);
void Uart1ClrFifo();




#endif /* UART1_H_ */
